<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
		<title></title>
	</head>
	<body class="container-fluid"><br>
		
		<div id="app">
			<input type="text" v-model="price"> {{price | currency("￥")}} 
			<br><br>
			<input type="text" v-model="length"> cm = {{length | meter}}
		</div>

		
		
		<script src="js/vue.js" ></script>
		<script>
			Vue.filter("currency",function(val,unit){
				val = val || 0;
				unit = unit || '$';
				return unit + val;
			})
			
			var vm = new Vue({
				el: '#app',
				data: {
					price: '',
					length: ''
				},
				filters: {
					meter: function(val,unit){
						val = val || 0;
						return val/100 + "m";
					}
				}
			});
		</script>
	</body>
</html>
